﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class views_admin_sppjqk : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Button2_Click(sender, e);
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string keyword = TextBox1.Text.Trim();
        if (string.IsNullOrEmpty(keyword))
        {
            Response.Write("<script>alert('请输入关键字')</script>");
            return;
        }
        var db = new PJTY.dal.DataClasses1DataContext();
        var query = from r in db.Review where r.ProductName.Contains(keyword) || r.ReviewContent.Contains(keyword) || r.Reviewnr.Contains(keyword) || r.ConsumerName.Contains(keyword) select r;
        rptProducts.DataSource = query;
        rptProducts.DataBind();
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        var db = new PJTY.dal.DataClasses1DataContext();
        var query = from r in db.Review select r;
        rptProducts.DataSource = query;
        rptProducts.DataBind();
    }
}